package com.codeoss.framework.view.renderer;

import java.util.Map;

import org.springframework.stereotype.Service;

import com.codeoss.framework.context.YunContext;
import com.codeoss.framework.view.component.Component;
import com.codeoss.framework.view.component.Page;

@Service
public class PageRenderer extends CommonComponentRenderer {
	protected void startRenderView(YunContext yunContext, Component component, ViewSerializeMap viewSerializeMap) {
		super.startRenderView(yunContext, component, viewSerializeMap);
		Page page=(Page)component;
		viewSerializeMap.put("code", page.getCode());
		viewSerializeMap.put("name", page.getName());
	}
	
	protected PropSerializeMap startRenderProp(YunContext yunContext,
			Component component, ViewPropMap viewPropMap) {
		PropSerializeMap propSerializeMap=super.startRenderProp(yunContext, component, viewPropMap);
		Map<String, Object> pageParaMap=yunContext.getPageParaMap();
		if(pageParaMap!=null) {
			propSerializeMap.put("paraList", pageParaMap.keySet());
			propSerializeMap.putAll(pageParaMap);
		}
		return propSerializeMap;
	}
}
